//
//  CoreDataManager.h
//  CoreData通讯录
//
//  Created by 邝子涵 on 15/11/20.
//  Copyright © 2015年 kuangzihan. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "Student.h"
@interface CoreDataManager : NSObject
//  单例
+ (CoreDataManager *)defaults;


@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;

- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;


#pragma mark - 添加联系人
- (Student *)addDataAddressBook:(NSString *)name
                     phone:(NSString *)phone
                       sex:(NSString *)sex
                    number:(NSNumber *)number
                        QQ:(NSString *)qq
               nativePlace:(NSString *)nativePlace;


#pragma mark - 查询方法
- (NSArray *)slect;

#pragma mark - 删除联系人
- (void)deleteName:(NSString *)name;

#pragma mark - 修改联系人
- (Student *)reviseAddressBook:(NSString *)name
                    phone:(NSString *)phone
                      sex:(NSString *)sex
                   number:(NSNumber *)number
                       QQ:(NSString *)qq
              nativePlace:(NSString *)nativePlace;


@end
